using UnityEngine;

namespace Assets.Scripts.GDK
{
	public class gdk_stringPlus
	{
		public static int string2int(string str)
		{
			int result = 0;
			if (!string.IsNullOrEmpty(str) && !int.TryParse(str, out result))
			{
				UnityEngine.Debug.Log("string2int error str = " + str);
			}
			return result;
		}

		public static long string2long(string str)
		{
			long result = 0L;
			if (!string.IsNullOrEmpty(str) && !long.TryParse(str, out result))
			{
				UnityEngine.Debug.Log("string2long error str = " + str);
			}
			return result;
		}

		public static float string2float(string str)
		{
			if (str == null || str.Equals(string.Empty))
			{
				return 0f;
			}
			return float.Parse(str);
		}

		public static bool string2bool(string str)
		{
			if (str == null || str.Equals(string.Empty))
			{
				return false;
			}
			return string2int(str) > 0;
		}

		public static int sortAsc(int a, int b)
		{
			return (a > b) ? 1 : ((a < b) ? (-1) : 0);
		}
	}
}
